<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增项目主合同')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <style>
		.file-preview {
		    padding: 0;
		    margin-bottom: 0;
		    border-radius: 0;
		    border: none;
		}
		
		.krajee-default.file-preview-frame {
		    margin-right: 20px;
		    padding: 0;
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default.file-preview-frame:not(.file-preview-error):hover {
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default .file-footer-caption {
			margin-bottom: 0;
		}
		
		.krajee-default.file-preview-frame .file-thumbnail-footer {
		    height: auto;
		}
		
		.krajee-default .file-caption-info {
			width: auto;
		}
		
		.kv-upload-progress .progress {
			margin-top: 0;
		}
		
		.krajee-default.file-preview-frame .kv-file-content,
		.krajee-default .file-size-info,
		.krajee-default .file-upload-indicator,
		.file-input .kv-file-upload,
		.file-input .kv-file-zoom {
			display: none;
		}
		
		.file-input .kv-file-remove {
			position: absolute;
			top: 3px;
			right: -15px;
			height: 14px;
			padding: 0;
			margin: 0;
			border: none;
			background: none;
		}
		
		.file-input .kv-file-remove:active, 
		.file-input .kv-file-remove:focus {
			background: none;
			outline: none;
			box-shadow: none;
		}
		
		.file-input .kv-file-remove .glyphicon-trash {
			color: red;
		}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-contract-add">
        	<input name="gcProjectId" type="hidden" th:value="${gcProject.id}" >
        	<input id="zilwj" name="zilwj" type="hidden">
        	<div class="form-group">
            	<label class="col-sm-2 control-label is-required">合同主体单位：</label>
            	<div class="col-sm-10">
            		<select name="ztdw" class="form-control" th:with="type=${@dict.getType('sj_gongs')}">
                    	<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                	</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">合同编号：</label>
                <div class="col-sm-4">
                    <input name="orderNo" class="form-control" type="text" th:value="${orderNo}" readonly="readonly">
                </div>
                <label class="col-sm-2 control-label">申报部门：</label>
                <div class="col-sm-4">
                    <input name="dept" class="form-control" type="text" th:value="${user.dept.deptName}" readonly="readonly">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">申报人：</label>
                <div class="col-sm-4">
                    <input name="owner" class="form-control" type="text" th:value="${user.loginName}" readonly="readonly">
                </div>
                <label class="col-sm-2 control-label">附件数：</label>
                <div class="col-sm-4">
                    <input name="fjs" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">申报类别：</label>
                <div class="col-sm-4">
                    <select name="type" class="form-control" th:with="type=${@dict.getType('sj_contract_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
                <label class="col-sm-2 control-label">项目名称：</label>
                <div class="col-sm-4">
                	<input name="projectName" class="form-control" type="text" th:value="${gcProject.name}" readonly="readonly" autoComplete="off">
<!--                     <select id="projectName" name="projectName" class="form-control" > -->
<!-- 						<option th:each="cl:${gplis}" th:value="${cl.name}" th:text="${cl.name}"></option> -->
<!-- 					</select> -->
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">合同金额：</label>
                <div class="col-sm-4">
                    <input name="htje" class="form-control" type="text">
                </div>
                <label class="col-sm-2 control-label">合同对方：</label>
                <div class="col-sm-4">
                    <select id="customerName" name="customerName" class="form-control" >
						<option th:each="cl:${clis}" th:value="${cl.name}" th:text="${cl.name}"></option>
					</select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">说明：</label>
                <div class="col-sm-10">
                    <textarea name="descs" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">
	            <label class="col-xs-2 control-label">法务审核：</label>
	            <div class="col-xs-4">
	                <select id="post" class="form-control" name="fwsh">
	                    <option th:each="ul:${userlist}" th:value="${ul.loginName}" th:text="${ul.userName}" ></option>
	                </select>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-2 control-label font-noraml">评审合同文件：</label>
	            <div class="col-sm-10">
	            	<div class="file-loading">
		            	<input id="multipleFile" name="files" type="file" multiple>
		        	</div>
	            </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-primary" onclick="addSubmitHandler()"><i class="fa fa-check"></i>提 交</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <th:block th:include="include :: bootstrap-suggest-js" />
    <th:block th:include="include :: bootstrap-typeahead-js" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var prefix = ctx + "yy/contract"
        $("#form-contract-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-contract-add').serialize());
            }
        }
        
        function addSubmitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/addSubmit", $('#form-contract-add').serialize());
            }
        }
        
        $(document).ready(function () {
		       // 多图上传
		       $("#multipleFile").fileinput({
		           uploadUrl: "/common/uploads",
		           uploadAsync: false,
		           showClose: false,
		           showCancel: false,
		           dropZoneEnabled: false,
		           buttonLabelClass: ''
		       }).on('filebatchuploadsuccess', function (event, data, previewId, index) {
		       	var rsp = data.response;
//		       	   log.info("return urls：" + rsp.urls)
		           log.info("reutrn fileNames：" + rsp.fileNames)
//		           log.info("reutrn newFileNames：" + rsp.newFileNames)
//		           log.info("return originalFilenames：" + rsp.originalFilenames)
				   $("#zilwj").val(rsp.fileNames);
		       }).on('fileremoved', function (event, id, index) {
		           $("input[name='" + event.currentTarget.id + "']").val('')
		       })
		 });
        
    </script>
</body>
</html>